package com.example.rocket.controller;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 引入的是spring封装后的rocketMQ坐标
 * 所以配置文件中配置之后，无需在这里配置name-server
 *
 * @Author ifredomvip@gmail.com
 * @Date 2022/8/16 16:12
 * @Version 1.0.0
 * @Description
 **/
@Slf4j
@Component
@RocketMQMessageListener(consumerGroup = "consumer-group", topic = "topic-tag")
public class ConsumerTagMessage implements RocketMQListener<String> {

    @Override
    public void onMessage(String tag) {
        // 重写消息处理方法

        log.info("------- tagConsumer received:{} \n", tag);

        // 对消息进行处理，比如写入数据
    }
}
